import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:new_yuqib_app/yqbConfig/custom_button.dart';
import 'package:new_yuqib_app/yqbConfig/custom_font_style.dart';

import 'controller.dart';

///设置界面
class SetPage extends StatefulWidget {
  const SetPage({super.key});

  @override
  State<SetPage> createState() => _SetPageState();
}

class _SetPageState extends State<SetPage> {
  @override
  Widget build(BuildContext context) {
    final controller = Get.put(SetController());
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        leading: const CupertinoNavigationBarBackButton(color: Colors.black),
        title: const Text('设置'),
        centerTitle: true,
      ),
      body: Column(
        children: [
          // ListTile(
          //   leading:  Text("新版本自动更新（仅wifi环境下）",style: CustomFontStyle.defaultStyle(size: 16),),
          //   trailing: Obx(() {
          //     return Switch(
          //       value: controller.isUpload.value,
          //       activeColor: const Color(0XFFFEB413),
          //       onChanged: (val) {
          //         controller.onChange();
          //       },
          //     );
          //   }),
          // ),
          ListTile(
            onTap: controller.cleanPreference,
            leading: Text("清除缓存",style: CustomFontStyle.defaultStyle(size: 16),),
          ),
          const Expanded(child: SizedBox()),
          Padding(
            padding: const EdgeInsets.symmetric(horizontal: 16),
            child: CustomButton.radiusButton(height: 48,
                onTap: controller.signOut,
                text: "退出登录",
                color: const Color(0XFFFFB413),
                style: CustomFontStyle.defaultStyle(color: Colors.white)),
          ),
          CustomButton.radiusButton(height: 48, onTap: controller.logOut, text: "注销账户",),
          const SizedBox(height: 40),
        ],
      ),
    );
  }
}
